// 导入Vue
import Vue from 'vue'
// 导入vue-router
import VueRouter from 'vue-router'
// 引入组件路由
import ViewsRouter from './views'
// 引入页面路由
import PageRouter from './page'
// 导入路由配置文件
import ConfigRouter from '@/config/router.config'
// 引入router mode配置`
import { routerMode } from '@/config/env.config'
// 使用VueRouter
Vue.use(VueRouter)

const Router = new VueRouter({
  mode: routerMode,
  base: process.env.BASE_URL,
  scrollBehavior: () => ({ y: 0 })
  // routes: constantRouterMap
})
// 合并Router
Router.addRoutes([...PageRouter, ...ViewsRouter, ...ConfigRouter])
// 导出
export default Router
